package com.tmall.tmall.mapper;

import com.tmall.tmall.pojo.Category;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.BeanMetadataAttribute;

import java.nio.file.Path;
import java.util.List;

@Mapper
public interface CategoryMapper {
    List<Category> page(String name,Integer mid);

    @Select("select * from category where name=#{name} and delete_at is null")
    Category getByName(Category category);
    @Insert("insert into category (name,mid)value (#{name},#{mid})")
    void insert(Category category);

    @Select("select * from category where delete_at is null and mid=#{mid}")
    List<Category> getByMid(Integer mid);

    void update(Category category);

    @Select("select * from category where delete_at is null")
    List<Category> selectAll();

    @Select("select * from category where delete_at is null and id=#{cid}")
    Category getById(Integer cid);

//    @Select("select * from category where delete_at is null")
//    Category getById(Integer cid);
}
